export default {
    // 计算徽标显示动态显示数量
        getAllCount(state){
            let num = 0;
            state.car.forEach(item => {
                num += item.count;
            });   
            return num;  
        },
        getGoodsCount(state){
            let o = {};
            state.car.forEach( item => {
                o[item.id] = item.count
            })
            return o;
        },
        getGoodsSelected(state){
            var o = {};
            state.car.forEach( item => {
                o[item.id] = item.selected
            })
            return o;
        },
        getGoodsCountAndAmount(state){
            var o = {
                count: 0,
                amount: 0
            }
            state.car.forEach( item => {
                if(item.selected){
                    o.count += item.count;
                    o.amount += item.count * item.price;
                }
            })
            return o;
        }
}